<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册 - 简单商城</title>
    <link rel="stylesheet" href="css/styles.css">
    <style>
        /* 复用登录页面的样式 */
        .auth-container {
            max-width: 400px;
            margin: 2rem auto;
            padding: 2rem;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        .auth-form {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .form-group label {
            color: #2c3e50;
            font-weight: bold;
        }

        .form-group input {
            padding: 0.8rem;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 1rem;
        }

        .form-group input:focus {
            outline: none;
            border-color: #3498db;
            box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
        }

        .auth-btn {
            background-color: #3498db;
            color: white;
            padding: 0.8rem;
            border: none;
            border-radius: 4px;
            font-size: 1rem;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .auth-btn:hover {
            background-color: #2980b9;
        }

        .auth-links {
            margin-top: 1rem;
            text-align: center;
        }

        .auth-links a {
            color: #3498db;
            text-decoration: none;
        }

        .auth-links a:hover {
            text-decoration: underline;
        }

        .error-message {
            color: #e74c3c;
            font-size: 0.9rem;
            margin-top: 0.5rem;
            display: none;
        }

        .password-requirements {
            font-size: 0.85rem;
            color: #666;
            margin-top: 0.25rem;
        }
    </style>
</head>
<body>
    <header>
        <h1>简单商城</h1>
    </header>
    
    <main>
        <div class="auth-container">
            <h2 style="text-align: center; margin-bottom: 2rem;">用户注册</h2>
            <form class="auth-form" id="registerForm" onsubmit="return handleRegister(event)">
                <div class="form-group">
                    <label for="username">用户名</label>
                    <input type="text" id="username" name="username" required minlength="3">
                    <div class="password-requirements">用户名至少3个字符</div>
                </div>
                <div class="form-group">
                    <label for="email">电子邮箱</label>
                    <input type="email" id="email" name="email" required>
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" id="password" name="password" required minlength="6">
                    <div class="password-requirements">密码至少6个字符</div>
                </div>
                <div class="form-group">
                    <label for="confirmPassword">确认密码</label>
                    <input type="password" id="confirmPassword" name="confirmPassword" required>
                    <div class="error-message" id="registerError"></div>
                </div>
                <button type="submit" class="auth-btn">注册</button>
                <div class="auth-links">
                    <a href="login.html">已有账号？立即登录</a>
                </div>
            </form>
        </div>
    </main>

    <footer>
        <p>&copy; 2024 简单商城</p>
    </footer>

    <script src="js/auth.js"></script>
</body>
</html>